import threading
class singleInstance():
    instance = None 
    lock = threading.RLock()

    def __new__(cls, *args, **kwargs):
        with cls.lock:
            if cls.instance:
                return cls.instance
            cls.instance = object.__new__(cls)
            return cls.instance
    
    def __init__(self, name):
        self.name = name

obj1 = singleInstance("wayne")
obj2 = singleInstance("bob")
print(obj1==obj2) # 输出 True
